package view.servlet.ajax;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author wq3stone
 */

@WebServlet("/checkPassword2Register")
public class CheckPassword2Register extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html;charset=utf-8");
        String pwd1 = req.getParameter("password1");
        String pwd2 = req.getParameter("password2");
        PrintWriter out = resp.getWriter();
        if (!pwd1.equals(pwd2)) {
            out.print("<font color=red>两次密码输入不一致</font>");
        }
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
